<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/2/1
 * Time: 19:04
 */
require_once __DIR__ . '/../Protocols/ProtocolAPI.php';
require_once __DIR__ . '/../Protocols/GameType.php';
require_once __DIR__ . '/../Protocols/Status.php';
require_once __DIR__.'/../Channel/Client.php';
require_once __DIR__.'/../Channel/Server.php';
require_once __DIR__.'/../Module/User.php';
require_once __DIR__.'/../Player/PlayerAvatar.php';
class ServerResponse{
    public function processServerResponse($responseType, $status, $gameType, $responseTarget, $respnoseMsg){
        switch($responseType){
            case ProtocolAPI::$LOGIN_RESPONSE:
                $this->responseUserBasic($responseType, $status, $gameType, $responseTarget, $respnoseMsg);
                break;

        }
    }
    /**
     * 用于处理响应给一个用户的函数
     * @param 响应的类型
     * @param 响应状态
     * @param 游戏类型
     * @param 响应用户UID
     * @param 响应的消息体
     */
    public function responseUserBasic($responseType,$status,$gameType,$userUid,$responseMsg){
        $msg["head_code"]=$responseType;
        $msg["status"]=$status;
        $msg["game_type"]=$gameType;
        $msg["client_msg"]=json_decode(json_encode($responseMsg));
        // print_r($msg);
        //var_dump($msg["client_msg"]);

        \GatewayWorker\Lib\Gateway::sendToUid($userUid,$msg);
    }


}



?>